<?php

use Erp\module\Classes\GuanjiapoToken;
use Erp\pockets\ErpConf;

/**
 * @deprecated
 */
class GuanjiapoAction extends ErpActionPlugin implements ErpConf
{
    const API_NAME = 'guanjiapo';

    public function main()
    {
        if( self::API_NAME === self::API_NAME_GUANJIAPO){
            try {
                $callback = $this->getRequest()->getQuery();
                if (!empty($callback) && isset($callback['auth_code'])) {
                    GuanjiapoToken::getToken($callback['auth_code']);
                }else{
                    throw new \Exception('获取code报错');
                }
            }catch (\Exception $e){
                throw new \Exception($e);
            }
        }
    }
}